home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-01-09 | 32.4 KB | 124 lines | [TEXT/MPS ] |
- #if !defined(RXH) || defined(RX_WANT_SE_DEFS)
- #define RXH
-
- /* Copyright (C) 1992, 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICU t stop);
- extern int re_search (struct re_pattern_buffer * rxb, const char *string,
- int size, int startpos, int range,
- struct re_registers *regs);
- extern int re_match_2 (struct re_pattern_buffer * rxb,
- const char * string1, int size1,
- const char * string2, int size2,
- int pos, struct re_registers *regs, int stop);
- extern int re_match (struct re_pattern_buffer * rxb,
- const char * string,
- int size, int pos,
- struct re_registers *regs);
- extern reg_syntax_t re_set_syntax (reg_syntax_t syntax);
- extern void re_set_registers (struct re_pattern_buffer *bufp,
- struct re_registers *regs,
- unsigned num_regs,
- regoff_t * starts, regoff_t * ends);
- extern const char * re_compile_pattern (const char *pattern,
- int length,
- struct re_pattern_buffer * rxb);
- extern int re_compile_fastmap (struct re_pattern_buffer * rxb);
- extern char * re_comp (const char *s);
- extern int rx_exec (const char *s);
- extern int regcomp (regex_t * preg, const char * pattern, int cflags);
- extern int regexec (const regex_t *preg, const char *string,
- size_t nmatch, regmatch_t pmatch[],
- int eflags);
- extern size_t regerror (int errcode, const regex_t *preg,
- char *errbuf, size_t errbuf_size);
- extern void regfree (regex_t *preg);
-
- #else
- extern reg_errcode_t rx_compile ();
- extern int re_search_2 ();
- extern int re_search ();
- extern int re_match_2 ();
- extern int re_match ();
- extern reg_syntax_t re_set_syntax ();
- extern void re_set_registers ();
- extern const char * re_compile_pattern ();
- extern int re_compile_fastmap ();
- extern char * re_comp ();
- extern int rx_exec ();
- extern int regcomp ();
- extern int regexec ();
- extern size_t regerror ();
- extern void regfree ();
-
- #endif
-
-
- #else /* RX_WANT_SE_DEFS */
- /* Integers are used to represent side effects.
- *
- * Simple side effects are given negative integer names by these enums.
- *
- * Non-negative names are reserved for complex effects.
- *
- * Complex effects are those that take arguments. For example,
- * a register assignment associated with a group is complex because
- * it requires an argument to tell which group is being matched.
- *
- * The integer name of a complex effect is an index into rxb->se_params.
- */
-
- RX_DEF_SE(1, re_se_try, = -1) /* Epsilon from start state */
-
- RX_DEF_SE(0, re_se_pushback, = re_se_try - 1)
- RX_DEF_SE(0, re_se_push0, = re_se_pushback -1)
- RX_DEF_SE(0, re_se_pushpos, = re_se_push0 - 1)
- RX_DEF_SE(0, re_se_chkpos, = re_se_pushpos -1)
- RX_DEF_SE(0, re_se_poppos, = re_se_chkpos - 1)
-
- RX_DEF_SE(1, re_se_at_dot, = re_se_poppos - 1) /* Emacs only */
- RX_DEF_SE(0, re_se_syntax, = re_se_at_dot - 1) /* Emacs only */
- RX_DEF_SE(0, re_se_not_syntax, = re_se_syntax - 1) /* Emacs only */
-
- RX_DEF_SE(1, re_se_begbuf, = re_se_not_syntax - 1) /* match beginning of buffer */
- RX_DEF_SE(1, re_se_hat, = re_se_begbuf - 1) /* match beginning of line */
-
- RX_DEF_SE(1, re_se_wordbeg, = re_se_hat - 1)
- RX_DEF_SE(1, re_se_wordbound, = re_se_wordbeg - 1)
- RX_DEF_SE(1, re_se_notwordbound, = re_se_wordbound - 1)
-
- RX_DEF_SE(1, re_se_wordend, = re_se_notwordbound - 1)
- RX_DEF_SE(1, re_se_endbuf, = re_se_wordend - 1)
-
- /* This fails except at the end of a line.
- * It deserves to go here since it is typicly one of the last steps
- * in a match.
- */
- RX_DEF_SE(1, re_se_dollar, = re_se_endbuf - 1)
-
- /* Simple effects: */
- RX_DEF_SE(1, re_se_fail, = re_se_dollar - 1)
-
- /* Complex effects. These are used in the 'se' field of
- * a struct re_se_params. Indexes into the se array
- * are stored as instructions on nfa edges.
- */
- RX_DEF_CPLX_SE(1, re_se_win, = 0)
- RX_DEF_CPLX_SE(1, re_se_lparen, = re_se_win + 1)
- RX_DEF_CPLX_SE(1, re_se_rparen, = re_se_lparen + 1)
- RX_DEF_CPLX_SE(0, re_se_backref, = re_se_rparen + 1)
- RX_DEF_CPLX_SE(0, re_se_iter, = re_se_backref + 1)
- RX_DEF_CPLX_SE(0, re_se_end_iter, = re_se_iter + 1)
- RX_DEF_CPLX_SE(0, re_se_tv, = re_se_end_iter + 1)
-
- #endif
-
- #endif
-